import React from 'react'
import store from '../../store/store'

import getMovieRequest from "../../api/getMovieRequest"
import {movieAction} from "../../store/actions/movieAction"

export default function Movie() {
  const {count}=store.getState().count

const getMovieHandle= async()=>{
  const re= await getMovieRequest()
  store.dispatch(movieAction(re.data))
}

const {movie}=store.getState().movie
  return (
    <div>
      <div>count的值我也有{count}</div>
        <button onClick={getMovieHandle}>点击查询电影</button>
        <h1>电影的个数为{movie.length}</h1>
        <ul>
        {movie.map(item=>{
          return <li key={item.albumId}>{item.name}</li>
        })}
        </ul>
    </div>
  )
}
